import mysql.connector

def connect_db(config):
    return mysql.connector.connect(**config)

def query_user(username, db_config):
    conn = connect_db(db_config)
    cursor = conn.cursor()
    cursor.execute(f"SELECT * FROM users WHERE username='{username}'")
    result = cursor.fetchone()
    conn.close()
    return result
